using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Omniture.API;

namespace Omniture.Studio.Objects
{
	public class Options : IXmlable
	{
		private string _excludeFields = "";
		private bool _hideExcludedColumn = true;

		public bool HideExcludedColumn
		{
			get { return _hideExcludedColumn; }
			set { _hideExcludedColumn = value; }
		}

		public string ExcludeFields
		{
			get { return _excludeFields; }
			set { _excludeFields = value; }
		}

		public bool IsExcludedField(string field)
		{
			string[] arr = this.ExcludeFields.Replace("\r", "").Split('\n');
			foreach (string s in arr)
			{
				if (string.Compare(field, s, true) == 0)
					return true;
			}
			return false;
		}

		public List<string> ExcludedFieldsList
		{
			get
			{
				string[] arr = this.ExcludeFields.Replace("\r", "").Split('\n');
				List<string> retval = new List<string>();
				foreach (string s in arr)
				{
					if (s != "")
						retval.Add(s);
				}
				return retval;
			}
		}

		#region IXmlable Members

		public virtual void LoadXml(XmlNode parentNode)
		{
			//_excludeFields = XMLHelper.GetChildValue(parentNode, "excludeFields", _excludeFields);
			//_hideExcludedColumn = XMLHelper.GetChildValue(parentNode, "hideExcludedColumn", _hideExcludedColumn);
		}

		public virtual void SaveXml(XmlNode parentNode)
		{
			//XMLHelper.AddNode(parentNode, "excludeFields", this.ExcludeFields);
			//XMLHelper.AddNode(parentNode, "hideExcludedColumn", this.HideExcludedColumn);
		}

		#endregion
	}
}
